package top.xzhanyao.scaffold.security.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@Slf4j
@RestController
public class UserController {
/*

    @GetMapping("/user")
    public Object getUser(Authentication user, HttpServletRequest request) throws Exception {
        String header = request.getHeader("Authorization");
        String token = StringUtils.substringAfter(header, "Bearer ");
        Claims claims = Jwts.parser().setSigningKey("acdp".getBytes("UTF-8")).parseClaimsJws(token).getBody();
        String company = (String) claims.get("company");
        log.info(company);
        return user;
    }
*/

    @GetMapping("/user")
    public Principal user(Principal user){
        return user;
    }

}
